<?php
use  yii\helpers\Url;
use  yii\helpers\Html;
$menu    = \backend\modules\models\setting\Menu::findOne(['name'=>'新闻中心']);
$content = $menu->getLimitContent(2);
?>
<div class="col-md-6 col-lg-7">
    <div class="model-title">
        <div>新闻中心</div>
        <div class="title-line"></div>
        <i class="iconfont icon-xindiantu"></i>
    </div>
    <div id="carouselExampleCaptions" class="carousel slide" data-ride="carousel" data-interval="false">
        <ol class="carousel-indicators">
            <li data-target="#carouselExampleCaptions" data-slide-to="0" class="active"></li>
            <li data-target="#carouselExampleCaptions" data-slide-to="1" class=""></li>
        </ol>
        <div class="carousel-inner">
            <?php if ($content) {?>
                <?php foreach ($content as $one => $first): ?>
                    <?php if ($one == 0) {?>
                        <a class="carousel-item a-href active" href="<?= Url::to(['site/content','content_id'=>$first->id])?>" data-id="<?= Html::encode($first->id)?>">
                    <?php }else {?>
                        <a class="carousel-item a-href" href="<?= Url::to(['site/content','content_id'=>$first->id])?>" data-id="<?= Html::encode($first->id)?>">
                    <?php }?>
                        <img src="<?= Html::encode($first->image)?>" class="d-block w-100" />
                            <div class="carousel-caption d-md-block">
                                <h5><?= Html::encode($first->title)?></h5>
                                <hr class="news-hr" />
                                <p><?= Html::encode($first->resume)?></p>
                            </div>
                        </a>
                <?php endforeach ?>
            <?php }?>
        </div>
    </div>
</div>